﻿namespace Okazuki.MVVM.PrismSupport.FSharp

open System
open System.Windows
open Microsoft.Practices.Prism.Interactivity.InteractionRequest
open Microsoft.Practices.Prism.Interactivity

[<AutoOpen>]
module Extra =
    // InteractionRequest<T>のメソッドを拡張
    type InteractionRequest<'a when 'a :> Notification> with
        /// 非同期ワークフロー対応のRaiseメソッド
        member x.RaiseAsync (n : 'a) =
            Async.FromContinuations (fun (cont, econt, ccont) ->
                    x.Raise(n, fun r -> cont(r))
                )
